package com.ycz.sas.jgen.main;

import java.lang.reflect.Constructor;

import com.ycz.sas.jgen.util.Resource;


public class AppMain {

	private static Object getObjectByConstructor(String className, Class[] argsClazz, Object[] args){
		Object obj = null;

		try {
			Class clazz = Class.forName(className);
			Constructor constructor = clazz.getDeclaredConstructor(argsClazz);
			obj = constructor.newInstance(args);

		} catch (Exception e) {
			e.printStackTrace();
		}


		return obj;
	}
	
	static void initContext(){
		ContextUtil.setLocale(LocaleEnum.ZH.getLocale());
		Resource res = new Resource();
		String sysConfig = "com.ycz.sas.jgen.conf";
		ContextUtil.setHome(res.getResourceString(sysConfig, "jgen_home"));
		ContextUtil.setConfigPath(res.getResourceString(sysConfig, "config"));
		ContextUtil.setJarPath(res.getResourceString(sysConfig, "destjar"));
		ContextUtil.setLogPath(res.getResourceString(sysConfig, "log"));
	}

	public static void main(String[] args) {
		initContext();
		Class[] clazz = new Class[]{};
		getObjectByConstructor("com.ycz.sas.jgen.ui.JarToolUI", clazz, new String[]{});
	}

}
